import request from "@/utils/request";

/**
 * Order ——> 实体大驼峰
 * order ——> 实体小驼峰
 * 订单 ——> 实体中文名
 * bg-print ——> 服务名
 */

/**
 * 查询Order分页列表
 */
export function getOrderPageList(params) {
    return request.get(
        "/order/list",
        {params}
    );
}

/**
 * 查询自己的订单
 */
export function getMyOrderPageList(params) {
    return request.get(
        "/order/my",
        {params}
    );
}

/**
 * 根据id查询order
 */
export function getOrderById(orderId) {
    return request.get(
        `/order/info/${orderId}`
    );
}


/**
 * 新增order
 */
export function createOrder(data) {
    return request.post(
        "/order/save",
        data
    );
}


/**
 * 修改order
 */
export function updateOrder(data) {
    return request.put(
        "/order/update",
        data
    );
}

/**
 * 申请报价(前)
 */
export function toqMoney(id) {
    return request.put(
        `/order/toqMoney/${id}`
    );
}

/**
 * 申请取消订单(前)
 */
export function toqcancel(id) {
    return request.put(
        `/order/toqcancel/${id}`
    );
}

/**
 * 取消取消订单(前)
 */
export function giveUpcancel(id) {
    return request.put(
        `/order/giveUpcancel/${id}`
    );
}

/**
 * 订单完成(前)
 */
export function okOrder(id) {
    return request.put(
        `/order/okOrder/${id}`
    );
}

/**
 * 报价
 */
export function tookMoney(orderId, money) {
    return request.putForm(
        `/order/tookMoney/`,
        {orderId, money}
    );
}

/** 打印中 */
export function toprintingOrder(id) {
    return request.put(
        `/order/toprinting/${id}`
    );
}

/** 打印完成 */
export function okprintOrder(id) {
    return request.put(
        `/order/okprint/${id}`
    );
}

/** 同意取消订单 */
export function tookcancelOrder(id) {
    return request.put(
        `/order/tookcancel/${id}`
    );
}

/** 驳回取消订单 */
export function tonocancelOrder(id) {
    return request.put(
        `/order/tonocancel/${id}`
    );
}

/**
 * 批量删除order
 * delete传body参数需要使用config将data传递进去
 */
export function deleteOrderBatchByIds(data) {
    return request.delete(
        "/order/delete",
        {data}
    );
}